#pragma once

#include "utilities/utilities.h"
#include "Component/Util/AppModuleModel.h"
#include <QList>
#include <QAbstractListModel>
#include "utilities/Locks.h"
#include <QLinkedList>
#include <deque>

class DisplayModel : public AppModuleModel , public QAbstractTableModel
{
public:
	DisplayModel(AppModule* moduleref);
	void handlePackets(const PacketArray& packets);

	int rowCount(const QModelIndex& parent) const;

	QVariant data(const QModelIndex &index, int role) const;
	int columnCount(const QModelIndex &parent) const;
	QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
	PacketPtr getPacket(int row);
protected:
	void onModuleOptChanged();
	void onGlobalOptChanged();
 
private:
	//QList< PacketPtr > m_DisplayBuffer;
	std::deque<PacketPtr> m_DisplayBuffer;
	UsrModeLock* mListLock;
	int mDisplayBufferSize;
};